import sys
import os
import traceback
import xmlrpc_client

def main(url, sample_path, output):
	sample_list = os.listdir(sample_path)
	for each in sample_list:
		print "Analyzing ", each
		try:
			xmlrpc_client.main(url, sample_path + os.sep + each, output)
		except:
			exc_type, exc_value, exc_traceback =  sys.exc_info()
			traceback.print_exception(exc_type, exc_value, exc_traceback)

def usage():
	print "Usage:", sys.argv[0], "<url | auto> <sample directory> <output directory>"
	print

if __name__ == "__main__":
	if len(sys.argv) < 4:
		usage()
		sys.exit(0)
	else:
		main(sys.argv[1], sys.argv[2], sys.argv[3])